<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //set集合 里面的元素是唯一的
        let target = [1,3,5]
        let source = [1,3,4,5]
        const set = new Set(target,source)
        //add增
        set.add(7)
        //delete删
        set.delete(1)
        console.log(set.size)
        console.log(set)

        //实现去重
        let arr = [1,2,4,2,5,6,1]
        let hah = new Set(arr)
        console.log(hah)
        const result = Array.from(hah)
        console.log(result)

        //map映射
        //map 的key是任意的 
         const obj = {name:'lipam'}
         let map = new Map()
         //增
         map.set('age',12).set('name','lisi')
         //删
         map.delete('name')
         //清空
        //  map.clear()
         //查
        console.log(map.has('age')) 
        //循环
        for(var k of map ){
            console.log(k)
        }
         console.log(map)

        
    </script>
</body>
</html>